package com.ruoyi.personnel.oa.sequence.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.personnel.oa.note.domain.Note;
import com.ruoyi.personnel.oa.note.domain.NoteCond;
import com.ruoyi.personnel.oa.sequence.domain.ApproveSequence;
import com.ruoyi.personnel.oa.sequence.domain.ApproveSequenceCond;
import com.ruoyi.personnel.oa.sequence.service.IApproveSequenceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 视图层
 * 审批顺序
 */
@RestController
@RequestMapping("/oa/approve/sequence")
@Api(value = "审批顺序模块", tags = "审批顺序接口")
public class ApproveSequenceController extends BaseController {
    @Autowired
    private IApproveSequenceService approveSequenceService;

    /**
     * 根据搜索条件所有审批顺序
     * @return
     */
    @ApiOperation(value = "获取审批顺序列表",notes = "查询所有审批顺序信息")
    @PostMapping("/list")
    public TableDataInfo list(@RequestBody ApproveSequenceCond cond) {
        startPage();
        List<ApproveSequence> approveSequenceList = approveSequenceService.selectSequenceList(cond);
        return getDataTable(approveSequenceList);
    }

    /**
     * 修改审批顺序
     * @param approveSequence
     * @return
     */
    @ApiOperation(value = "修改审批顺序", notes = "修改审批顺序")
    @ApiImplicitParam(name = "note", value = "修改审批顺序", dataType = "ApproveSequence")
    @PostMapping("/edit")
    public AjaxResult edit(@Validated @RequestBody ApproveSequence approveSequence) {
        return toAjax(approveSequenceService.updateSequence(approveSequence));
    }
}
